package songZhao.MinaDemo.Example;

import java.nio.charset.Charset;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class ExampleProtocolFactory implements ProtocolCodecFactory{
	private ExampleProtocolDecoder decoder;
	private ExampleProtocolEncoder encoder;
	public ExampleProtocolFactory(Charset charset) {
		decoder = new ExampleProtocolDecoder(charset);
		encoder = new ExampleProtocolEncoder(charset);
	}
	
	@Override
	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		 return encoder;
	}

	@Override
	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		return decoder;
	}

}
